﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaiser.Modules.Cubic.Repositories;

namespace Kaiser.Modules.Cubic.Services.Impl
{
    public class AdvertSpaceService : IAdvertSpaceService
    {
        public void Insert(DomainModel.Advert.AdvertSpace model)
        {
            try
            {
                RepositoriesFactory.CreateIAdvertSpaceRepositorie().Insert(model);
            }
            catch (Exception)
            {
                    
                throw;
            }
        }

        public void Update(DomainModel.Advert.AdvertSpace model)
        {
            try
            {
                RepositoriesFactory.CreateIAdvertSpaceRepositorie().Update(model);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public int Delete(object primaryId)
        {
            try
            {
             return   RepositoriesFactory.CreateIAdvertSpaceRepositorie().Delete(primaryId);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public int DeleteList(IList<string> ids)
        {
            try
            {
                return RepositoriesFactory.CreateIAdvertSpaceRepositorie().Delete(ids);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public DomainModel.Advert.AdvertSpace Get(object primaryId)
        {
            try
            {
                return RepositoriesFactory.CreateIAdvertSpaceRepositorie().Get(primaryId);
            }
            catch (Exception)
            {

                throw;
            }
        }

        public Models.DataGrid<DomainModel.Advert.AdvertSpace> Search(ViewModel.AdvertSpaceSearch search, Models.PagingInfo pageinfo)
        {
            try
            {
                return RepositoriesFactory.CreateIAdvertSpaceRepositorie().Search(search, pageinfo);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
